#include<string.h>
#include<stdlib.h>

char *removeDigit(char *number, char digit)
{
    char *max = (char *)calloc(sizeof(char), strlen(number));
    char *buffer = (char *)malloc(sizeof(char) * strlen(number));
    max[strlen(number) - 1] = '\0';

    for (int i = 0; i < strlen(number); i++)
    {
        if (number[i] == digit)
        {
            memcpy(&buffer[0], &number[0], sizeof(char) * (i));
            memcpy(&buffer[i], &number[i + 1], strlen(number) - i - 1);
            buffer[strlen(number) - 1] = '\0';
            if (strcmp(max, buffer) < 0)
            {
                strcpy(max, buffer);
            }
        }
    }

    printf("max = %s\n", max);
    return max;
}